package com.lp.biz.operations.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lp.biz.operations.model.entity.BizRecommend;
import lombok.Data;

import java.time.LocalDateTime;

import static com.lp.common.constant.CommonConstant.DATE_TIME;
import static com.lp.common.constant.CommonConstant.DATE_MIN;
import static com.lp.common.constant.CommonConstant.TIMEZONE;

/**
 * @program: backend
 * @description:
 * @author: Ke.Song
 * @since: 2024-07-10 22:14:19
 */
@Data
public class HomeRecommendList {

    private Integer id;

    private String title;

    @JsonFormat(timezone = TIMEZONE, pattern = DATE_MIN)
    private LocalDateTime startAt;

    @JsonFormat(timezone = TIMEZONE, pattern = DATE_MIN)
    private LocalDateTime endAt;

    private Integer status;

    private Integer bizCategoryId;

    private String bizCategoryCode;

    @JsonFormat(timezone = TIMEZONE, pattern = DATE_TIME)
    private LocalDateTime createAt;

    private Integer type;

    private Integer level;

    private Integer size;

    private Integer sort;

    private Integer parentId;

    private Integer align;

    public static HomeRecommendList builder(BizRecommend bizRecommend) {
        HomeRecommendList temp = new HomeRecommendList();
        temp.setId(bizRecommend.getId());
        temp.setTitle(bizRecommend.getName());
        temp.setStartAt(bizRecommend.getStartAt());
        temp.setEndAt(bizRecommend.getEndAt());
        temp.setStatus(bizRecommend.getIsDisplay());
        temp.setBizCategoryId(bizRecommend.getBizCategoryId());
        temp.setBizCategoryCode(bizRecommend.getBizCategoryCode());
        temp.setCreateAt(bizRecommend.getCreateAt());
        temp.setType(bizRecommend.getType());
        temp.setLevel(bizRecommend.getLevel());
        temp.setSize(bizRecommend.getSize());
        temp.setSort(bizRecommend.getSort());
        temp.setParentId(bizRecommend.getParentId());
        temp.setAlign(bizRecommend.getAlign());
        return temp;
    }
}
